﻿using System;
using System.IO;
using SEXY;
using UnityEngine;

namespace Character
{
	// Token: 0x020001AB RID: 427
	public class HeadParameter : ParameterBase
	{
		// Token: 0x06000B04 RID: 2820 RVA: 0x0003F440 File Offset: 0x0003D640
		public HeadParameter(SEX sex) : base(sex)
		{
			int num = (sex != SEX.FEMALE) ? CharDefine.cm_headshapename.Length : CharDefine.cf_headshapename.Length;
			this.shapeVals = new float[num];
			for (int i = 0; i < this.shapeVals.Length; i++)
			{
				this.shapeVals[i] = 0.5f;
			}
		}

		// Token: 0x06000B05 RID: 2821 RVA: 0x0003F548 File Offset: 0x0003D748
		public HeadParameter(HeadParameter copy) : base(copy.sex)
		{
			this.Copy(copy);
		}

		// Token: 0x06000B06 RID: 2822 RVA: 0x0003F610 File Offset: 0x0003D810
		public void Init()
		{
			this.headID = 0;
			this.faceTexID = 0;
			this.detailID = 0;
			this.detailWeight = 0f;
			this.eyeBrowID = 0;
			this.eyeBrowColor = new ColorParameter_PBR1();
			this.eyeScleraColorL = Color.white;
			this.eyeID_L = 0;
			this.eyeIrisColorL = Color.black;
			this.eyeScleraColorR = Color.white;
			this.eyeID_R = 0;
			this.eyeIrisColorR = Color.black;
			this.tattooID = 0;
			this.tattooColor = Color.white;
			if (this.shapeVals != null)
			{
				for (int i = 0; i < this.shapeVals.Length; i++)
				{
					this.shapeVals[i] = 0.5f;
				}
			}
			this.eyeLashID = 0;
			this.eyeLashColor = new ColorParameter_PBR1();
			this.eyeshadowTexID = 0;
			this.eyeshadowColor = Color.black;
			this.cheekTexID = 0;
			this.cheekColor = Color.white;
			this.lipTexID = 0;
			this.lipColor = Color.white;
			this.moleTexID = 0;
			this.moleColor = Color.white;
			this.eyeHighlightTexID = 0;
			this.eyeHighlightColor = new ColorParameter_EyeHighlight();
			this.beardID = 0;
			this.beardColor = Color.black;
		}

		// Token: 0x06000B07 RID: 2823 RVA: 0x0003F74C File Offset: 0x0003D94C
		public void Copy(HeadParameter copy)
		{
			if (this.shapeVals == null || this.shapeVals.Length != copy.shapeVals.Length)
			{
				this.shapeVals = new float[copy.shapeVals.Length];
			}
			Array.Copy(copy.shapeVals, this.shapeVals, this.shapeVals.Length);
			this.headID = copy.headID;
			this.faceTexID = copy.faceTexID;
			this.detailID = copy.detailID;
			this.detailWeight = copy.detailWeight;
			this.eyeBrowID = copy.eyeBrowID;
			this.eyeBrowColor = copy.eyeBrowColor;
			this.eyeID_L = copy.eyeID_L;
			this.eyeScleraColorL = copy.eyeScleraColorL;
			this.eyeIrisColorL = copy.eyeIrisColorL;
			this.eyePupilDilationL = copy.eyePupilDilationL;
			this.eyeEmissiveL = copy.eyeEmissiveL;
			this.eyeID_R = copy.eyeID_R;
			this.eyeScleraColorR = copy.eyeScleraColorR;
			this.eyeIrisColorR = copy.eyeIrisColorR;
			this.eyePupilDilationR = copy.eyePupilDilationR;
			this.eyeEmissiveR = copy.eyeEmissiveR;
			this.tattooID = copy.tattooID;
			this.tattooColor = copy.tattooColor;
			this.eyeLashID = copy.eyeLashID;
			this.eyeLashColor = copy.eyeLashColor;
			this.eyeshadowTexID = copy.eyeshadowTexID;
			this.eyeshadowColor = copy.eyeshadowColor;
			this.cheekTexID = copy.cheekTexID;
			this.cheekColor = copy.cheekColor;
			this.lipTexID = copy.lipTexID;
			this.lipColor = copy.lipColor;
			this.moleTexID = copy.moleTexID;
			this.moleColor = copy.moleColor;
			this.eyeHighlightTexID = copy.eyeHighlightTexID;
			this.eyeHighlightColor = copy.eyeHighlightColor;
			this.beardID = copy.beardID;
			this.beardColor = copy.beardColor;
		}

		// Token: 0x06000B08 RID: 2824 RVA: 0x0003F928 File Offset: 0x0003DB28
		public void Save(BinaryWriter writer, SEX sex)
		{
			base.Write(writer, this.headID);
			base.Write(writer, this.faceTexID);
			base.Write(writer, this.detailID);
			base.Write(writer, this.detailWeight);
			base.Write(writer, this.eyeBrowID);
			this.eyeBrowColor.Save(writer);
			base.Write(writer, this.eyeID_L);
			base.Write(writer, this.eyeScleraColorL);
			base.Write(writer, this.eyeIrisColorL);
			base.Write(writer, this.eyePupilDilationL);
			base.Write(writer, this.eyeEmissiveL);
			base.Write(writer, this.eyeID_R);
			base.Write(writer, this.eyeScleraColorR);
			base.Write(writer, this.eyeIrisColorR);
			base.Write(writer, this.eyePupilDilationR);
			base.Write(writer, this.eyeEmissiveR);
			base.Write(writer, this.tattooID);
			base.Write(writer, this.tattooColor);
			base.Write(writer, this.shapeVals);
			if (sex == SEX.FEMALE)
			{
				base.Write(writer, this.eyeLashID);
				this.eyeLashColor.Save(writer);
				base.Write(writer, this.eyeshadowTexID);
				base.Write(writer, this.eyeshadowColor);
				base.Write(writer, this.cheekTexID);
				base.Write(writer, this.cheekColor);
				base.Write(writer, this.lipTexID);
				base.Write(writer, this.lipColor);
				base.Write(writer, this.moleTexID);
				base.Write(writer, this.moleColor);
				base.Write(writer, this.eyeHighlightTexID);
				this.eyeHighlightColor.Save(writer);
			}
			else if (sex == SEX.MALE)
			{
				base.Write(writer, this.beardID);
				base.Write(writer, this.beardColor);
				this.eyeHighlightColor.Save(writer);
			}
		}

		// Token: 0x06000B09 RID: 2825 RVA: 0x0003FB00 File Offset: 0x0003DD00
		public void Load(BinaryReader reader, SEX sex, CUSTOM_DATA_VERSION version)
		{
			Color white = Color.white;
			base.Read(reader, ref this.headID);
			base.Read(reader, ref this.faceTexID);
			base.Read(reader, ref this.detailID);
			base.Read(reader, ref this.detailWeight);
			base.Read(reader, ref this.eyeBrowID);
			this.eyeBrowColor.Load(reader, version);
			this.eyePupilDilationL = 0f;
			this.eyePupilDilationR = 0f;
			this.eyeEmissiveL = 0.5f;
			this.eyeEmissiveR = 0.5f;
			if (version < CUSTOM_DATA_VERSION.DEBUG_04)
			{
				base.Read(reader, ref this.eyeScleraColorL);
				this.eyeScleraColorR = this.eyeScleraColorL;
				base.Read(reader, ref this.eyeID_L);
				base.Read(reader, ref this.eyeIrisColorL);
				base.Read(reader, ref this.eyeID_R);
				base.Read(reader, ref this.eyeIrisColorR);
			}
			else
			{
				base.Read(reader, ref this.eyeID_L);
				base.Read(reader, ref this.eyeScleraColorL);
				base.Read(reader, ref this.eyeIrisColorL);
				base.Read(reader, ref this.eyePupilDilationL);
				if (version >= CUSTOM_DATA_VERSION.DEBUG_10)
				{
					base.Read(reader, ref this.eyeEmissiveL);
				}
				base.Read(reader, ref this.eyeID_R);
				base.Read(reader, ref this.eyeScleraColorR);
				base.Read(reader, ref this.eyeIrisColorR);
				base.Read(reader, ref this.eyePupilDilationR);
				if (version >= CUSTOM_DATA_VERSION.DEBUG_10)
				{
					base.Read(reader, ref this.eyeEmissiveR);
				}
			}
			base.Read(reader, ref this.tattooID);
			base.Read(reader, ref this.tattooColor);
			base.Read(reader, ref this.shapeVals);
			if (sex == SEX.FEMALE)
			{
				base.Read(reader, ref this.eyeLashID);
				this.eyeLashColor.Load(reader, version);
				base.Read(reader, ref this.eyeshadowTexID);
				base.Read(reader, ref this.eyeshadowColor);
				base.Read(reader, ref this.cheekTexID);
				base.Read(reader, ref this.cheekColor);
				base.Read(reader, ref this.lipTexID);
				base.Read(reader, ref this.lipColor);
				base.Read(reader, ref this.moleTexID);
				base.Read(reader, ref this.moleColor);
				base.Read(reader, ref this.eyeHighlightTexID);
				this.eyeHighlightColor.Load(reader, version);
			}
			else if (sex == SEX.MALE)
			{
				base.Read(reader, ref this.beardID);
				base.Read(reader, ref this.beardColor);
				if (version >= CUSTOM_DATA_VERSION.DEBUG_02)
				{
					this.eyeHighlightColor.Load(reader, version);
				}
			}
		}

		// Token: 0x06000B0A RID: 2826 RVA: 0x0003FD80 File Offset: 0x0003DF80
		public bool CheckEyeEqual()
		{
			return this.eyeID_L == this.eyeID_R && this.eyeScleraColorL == this.eyeScleraColorR && this.eyeIrisColorL == this.eyeIrisColorR && this.eyePupilDilationL == this.eyePupilDilationR;
		}

		// Token: 0x04000B52 RID: 2898
		public int headID;

		// Token: 0x04000B53 RID: 2899
		public int faceTexID;

		// Token: 0x04000B54 RID: 2900
		public int detailID;

		// Token: 0x04000B55 RID: 2901
		public float detailWeight;

		// Token: 0x04000B56 RID: 2902
		public int eyeBrowID;

		// Token: 0x04000B57 RID: 2903
		public ColorParameter_PBR1 eyeBrowColor = new ColorParameter_PBR1();

		// Token: 0x04000B58 RID: 2904
		public int eyeID_L;

		// Token: 0x04000B59 RID: 2905
		public Color eyeScleraColorL = Color.white;

		// Token: 0x04000B5A RID: 2906
		public Color eyeIrisColorL = Color.black;

		// Token: 0x04000B5B RID: 2907
		public float eyePupilDilationL;

		// Token: 0x04000B5C RID: 2908
		public float eyeEmissiveL = 0.5f;

		// Token: 0x04000B5D RID: 2909
		public int eyeID_R;

		// Token: 0x04000B5E RID: 2910
		public Color eyeScleraColorR = Color.white;

		// Token: 0x04000B5F RID: 2911
		public Color eyeIrisColorR = Color.black;

		// Token: 0x04000B60 RID: 2912
		public float eyePupilDilationR;

		// Token: 0x04000B61 RID: 2913
		public float eyeEmissiveR = 0.5f;

		// Token: 0x04000B62 RID: 2914
		public int tattooID;

		// Token: 0x04000B63 RID: 2915
		public Color tattooColor = Color.white;

		// Token: 0x04000B64 RID: 2916
		public float[] shapeVals;

		// Token: 0x04000B65 RID: 2917
		public int eyeLashID;

		// Token: 0x04000B66 RID: 2918
		public ColorParameter_PBR1 eyeLashColor = new ColorParameter_PBR1();

		// Token: 0x04000B67 RID: 2919
		public int eyeshadowTexID;

		// Token: 0x04000B68 RID: 2920
		public Color eyeshadowColor = Color.black;

		// Token: 0x04000B69 RID: 2921
		public int cheekTexID;

		// Token: 0x04000B6A RID: 2922
		public Color cheekColor = Color.white;

		// Token: 0x04000B6B RID: 2923
		public int lipTexID;

		// Token: 0x04000B6C RID: 2924
		public Color lipColor = Color.white;

		// Token: 0x04000B6D RID: 2925
		public int moleTexID;

		// Token: 0x04000B6E RID: 2926
		public Color moleColor = Color.white;

		// Token: 0x04000B6F RID: 2927
		public int eyeHighlightTexID;

		// Token: 0x04000B70 RID: 2928
		public ColorParameter_EyeHighlight eyeHighlightColor = new ColorParameter_EyeHighlight();

		// Token: 0x04000B71 RID: 2929
		public int beardID;

		// Token: 0x04000B72 RID: 2930
		public Color beardColor = Color.black;
	}
}
